﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EncryptHelper;
using System.Security.Cryptography;
using System.Configuration;
using WebHelper.Handlers;
using WebHelper.Modules;
using WebHelper.TraceListeners;
using System.Reflection;

namespace WebApplicationTest
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //System.Web.UI.Extended a = new Extended();
            //a.CreateDevLicence(@"D:\Developping\new developped programs\Liberaries\DevLicence\bin\Release\DevLicence.DLL", @"D:\Developping\new developped programs\Liberaries\MyProtector\bin\Release\DevLicence.DLL");
            //DevLicence.Executer b = new DevLicence.Executer();
            //b.Execute();
            //Assembly assem = b.GetType().Assembly;
            //object obj = assem.CreateInstance("DevLicence.Executer");
            //obj.GetType().InvokeMember("Execute", BindingFlags.InvokeMethod, null, obj, null);

            //System.Web.UI.Extended.UnRegister("");
            TelerikHelper.AdvancedDateTimePicker dddd = new TelerikHelper.AdvancedDateTimePicker();
            //this.AdvancedDateTimePicker.MinDate = DateTime.Now.Date.AddDays(-3);
            //this.AdvancedDateTimePicker.MaxDate = DateTime.Now.Date.AddDays(3);
            //string s = ImageEdittingHandler.Register(true, "");
            //s = GradientImageHandler.Register(true, "");
            //s = BinaryDataHandler.Register(true, "");
            //s = DownloadHandler.Register(true, "");
            //s = SecurityModule.Register(true, "");
            //s = ScheduleModule.Register(true, "");

            //ImageEdittingHandler.UnRegister("");
            //GradientImageHandler.UnRegister("");
            //BinaryDataHandler.UnRegister("");
            //DownloadHandler.UnRegister("");
            //SecurityModule.UnRegister("");
            //ScheduleModule.UnRegister("");
            //System.Diagnostics.Trace.Listeners.Add(new CustomTraceListener());
            //CustomTraceListener.ForwardWebTrace("");
           // CustomTraceListener.Register(true, "", "~/traceData", "trace.log", 100, 10);
            //CustomTraceListener.Register(true,"");
            //Trace.Write("webpagetrace");

            //System.Diagnostics.Trace.WriteLine("toot","test");



            //WebHelper.Helpers.ShortcutHelper a = new WebHelper.Helpers.ShortcutHelper();
            //a.Target="E:\\Games\\احمد محمد حسن\\K     Jةىلا.exe";
            //a.Description="test shortcut fo dj.exe";
            //a.DisplayMode=WebHelper.Helpers.ShortcutHelper.LinkDisplayMode.edmNormal;
            //a.Save("D:\\uvfd عربي\\عربي عربي"+"\\eeeeeee.ght");


            //SecurityModule custSection = (SecurityModule)ConfigurationManager.GetSection(typeof(SecurityModule).Name);
            

            //WebHelper.TraceListeners.CustomTraceListener a = new WebHelper.TraceListeners.CustomTraceListener();
            //for (int i = 0; i < 2000; i++)
            //{
            //    //a.WriteTraceInformation("message " + i, "category " + i, System.Diagnostics.TraceLevel.Info);
            //}


            //string s = ImageEdittingHandler.GetRegistration(true,"");
            //s = GradientImageHandler.GetRegistration(true,"");
            //s = BinaryDataHandler.GetRegistration(true,"");
            //s = DownloadHandler.GetRegistration(true, "");
            //System.Drawing.Image m = System.Drawing.Image.FromFile("D:\\2.jpg");
            //MemoryStream ms = new MemoryStream();
            //m.Save(ms,System.Drawing.Imaging.ImageFormat.Jpeg);
            //string link= BinaryDataHandler.Add(ms.ToArray(),"Image/jpg",false);
            //SecurityModule.GetRegistration(true,"");
            //ScheduleModule.GetRegistration(true, "");
            //ScheduleModule.Job job = ScheduleModule.AddJob("send mail", new DateTime(2013, 1, 1), new DateTime(2013, 3, 3), new TimeSpan(0, 0, 10, 0, 0), 3);
            //job.Execute += job_Execute;

            //SecurityModule.DecryptNeeded("");

            //SecurityModule.DisableSslCookies();
        }

        void job_Execute(object sender, EventArgs e)
        {
            
        }

        protected void Timer1_Tick(object sender, EventArgs e)
        {
        }

        protected void button1_Click(object sender, EventArgs e)
        {


            //DownloadHandler.Download(new Uri("http://localhost:4795/SQLFULL_ENU.iso"), "Windows8-ConsumerPreview-64bit-English.iso",true);
            //DownloadHandler.Download(new Uri("http://download.microsoft.com/download/D/B/0/DB03922C-FF91-4845-B7F2-FC68595AB730/VS2012_ULT_enu.iso"), "Windows8-ConsumerPreview-64bit-English.iso");
            
            //this.textbox2.Text = DefaultEncryptHelper.Encrypt(this.textbox1.Text, "nada292009");
            //this.textbox3.Text = DefaultEncryptHelper.Decrypt(this.textbox2.Text, "nada292009");
            //DefaultEncryptHelper.Encrypt(@"C:\Users\ahmed\Desktop\1.txt", @"C:\Users\ahmed\Desktop\2.txt", "nada292009");
            //DefaultEncryptHelper.Decrypt(@"C:\Users\ahmed\Desktop\2.txt", @"C:\Users\ahmed\Desktop\3.txt", "nada292009");
        }
        protected void button2_Click(object sender, EventArgs e)
        {


            //DownloadHandler.Download(new Uri("http://localhost:4795/SQLFULL_ENU.iso"), "Windows8-ConsumerPreview-64bit-English.iso");
            //DownloadHandler.Download(new Uri("http://download.microsoft.com/download/D/B/0/DB03922C-FF91-4845-B7F2-FC68595AB730/VS2012_ULT_enu.iso"), "Windows8-ConsumerPreview-64bit-English.iso",true);

            //this.textbox2.Text = DefaultEncryptHelper.Encrypt(this.textbox1.Text, "nada292009");
            //this.textbox3.Text = DefaultEncryptHelper.Decrypt(this.textbox2.Text, "nada292009");
            //DefaultEncryptHelper.Encrypt(@"C:\Users\ahmed\Desktop\1.txt", @"C:\Users\ahmed\Desktop\2.txt", "nada292009");
            //DefaultEncryptHelper.Decrypt(@"C:\Users\ahmed\Desktop\2.txt", @"C:\Users\ahmed\Desktop\3.txt", "nada292009");
        }

    }
}